function x = newton_raphson(x0,a,b,pts,C,tol,numit)

x_ant = x0;
indit = 0;

fprintf(1,'x(%d):%f f(x):%f\n',indit,x0,C-A(x0,a,b,pts));


while abs(C-A(x_ant,a,b,pts)) > tol && indit < numit,
    
    x = x_ant + (C-A(x_ant,a,b,pts)) / derA(x_ant,a,b,pts);

    indit=indit+1;
    
    fprintf(1,'x(%d):%f f(x):%f x(%d)-x(%d):%f\n',...
        indit,x,C-A(x,a,b,pts),indit,indit-1,x-x_ant);

    x_ant = x;

end

%fprintf(1,'numero iteraciones: %d\n',indit);